|
|
|
|
|
|
|
form or picture box's AutoRedraw property to true, that control's Image property holds a valid copy of whatever the control displays. If a program tries to use the PaintPicture method with an invalid source parameter, Visual Basic generates an Invalid picture error. |
|
|
|
|
|
|
|
|
The Picture and Image properties are often a source of great confusion. When AutoRedraw is True, the Image property is a permanent copy of the control's surface in memory. The Picture property is used for repainting the control when it is cleared. To make a control's visible contents a permanent part of the background, the program should set the control's Picture property equal to its Image property. The following code shows how a program might draw a line on one picture box, make it a permanent part of its background image, and then copy it to a second picture box. |
|
|
|
 |
|
|
|
|
' Set AutoRedraw = True so we can use the Image property. picFrom.AutoRedraw = True
' Draw a line. picFrom.Line (0, 0)-(1440, 1440)
' Make the a line permanent part of the picture. picFrom.Picture = picFrom.Image
' Copy the image from picFrom to picTo. picTo.PaintPicture picFrom.Picture, 0, 0 |
|
|
|
|
|
|
|
|
PaintPicture's opcode parameter tells PaintPicture how to merge the pixels in the source image with those in the destination image. The bits that define the pixels are combined according to different bitwise Boolean operations depending on the value of opcode. Visual Basic has defined constants for the most commonly used opcodes. |
|
|
|
|
| | | | | | | |
|
|
|
|
(NOT Source) OR Destination. |
|
|
|
| | | | |
|
|
|
|
NOT (Source OR Destination). |
|
|
|
| | | | | | |
|
|
|
|
((NOT Source) OR Pattern) OR Destination. |
|
|
|
| | | | | | |
|
|
|
|
(NOT Destination) AND Source. |
|
|
|
| | | | | | |
|
|
|